;==========================================================
;
;
;   ██████╗  ██████╗ ██╗  ██╗   ██╗██████╗  █████╗ ██████╗
;   ██╔══██╗██╔═══██╗██║  ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
;   ██████╔╝██║   ██║██║   ╚████╔╝ ██████╔╝███████║██████╔╝
;   ██╔═══╝ ██║   ██║██║    ╚██╔╝  ██╔══██╗██╔══██║██╔══██╗
;   ██║     ╚██████╔╝███████╗██║   ██████╔╝██║  ██║██║  ██║
;   ╚═╝      ╚═════╝ ╚══════╝╚═╝   ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝
;
;
;   To learn more about how to configure Polybar
;   go to https://github.com/polybar/polybar
;
;   The README contains a lot of information
;
;==========================================================

[colors]
;background = ${xrdb:background}
background = #222222
;background-alt = #444
;foreground = ${xrdb:foreground}
foreground = #dfdfdf
;foreground-alt = ${xrdb:color7}
;primary = ${xrdb:color9}
secondary = #0000ff
alert = #ffff00

[bar/main]
monitor = ${env:MONITOR:}
width = 100%
height = 20
;offset-x = 1%
;offset-y = 1%
radius = 15.5
fixed-center = false

# background = ${colors.background}
# foreground = ${colors.foreground}

line-size = 2
line-color = #f00

border-left-size = 16
border-right-size = 16
border-top-size = 8
border-bottom-size = 0
border-color = #000000

padding-left = 2
padding-right = 2

module-margin-left = 1
module-margin-right = 1

font-0 = "Cascadia Code:pixelsize=12;2"
font-1 = "Font Awesome 5 Free:style=Regular:pixelsize=14;3"
font-2 = "Font Awesome 5 Free:style=Solid:pixelsize=14;3"
font-3 = "Font Awesome 5 Brands:pixelsize=14;3"

modules-left = i3 redshift
modules-center = spotify spotify-prev spotify-play-pause spotify-next
modules-right = network-ethernet network-wlan xkeyboard battery-internal battery-external pulseaudio backlight date separator bluetooth power-menu

;tray-position = right
;tray-padding = 2
;tray-background = #0063ff

;wm-restack = i3
;wm-restack = i3

override-redirect = false

;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev

;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev

cursor-click = pointer
cursor-scroll = ns-resize

enable-ipc = true

[bar/HDMI2]
inherit = bar/DP1
monitor = HDMI2

[bar/DP1]
inherit = bar/main
monitor = DP1

[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false

label-mode-padding = 2
label-mode-background = ${colors.background}
label-mode-foreground = ${colors.foreground}

; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.primary}
label-focused-underline= ${colors.primary}
label-focused-padding = 1

; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = 1

; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${colors.background}
label-visible-underline = ${colors.foreground}
label-visible-padding = 1

; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.primary}
label-urgent-padding = 1

[module/spotify]
type = custom/script
interval = 1
format-prefix = "%{F#ff217c}%{F-} "
format = <label>
exec = sh ~/.config/polybar/scripts/spotify.sh -i "%artist%{F#ff217c}:%{F-} %title" -e " "
exec-if = pgrep -x spotify

[module/spotify-prev]
type = custom/script
format = <label>
exec = echo "%{F#ff217c}%{F-}"
click-left = playerctl previous spotify
exec-if = pgrep -x spotify

[module/spotify-play-pause]
type = custom/script
format = <label>
exec = echo "%{F#ff217c}%{F-}"
click-left = playerctl play-pause spotify 
exec-if = pgrep -x spotify

[module/spotify-next]
type = custom/script
format = <label>
exec = echo "%{F#ff217c}%{F-}"
click-left = playerctl next spotify
exec-if = pgrep -x spotify

[module/network-ethernet]
type = internal/network
; Name of the network interface to display. You can get the names of the
; interfaces on your machine with `ip link`
; Wireless interfaces often start with `wl` and ethernet interface with `eno` or `eth`
interface = enp2s0

; Seconds to sleep between updates
; Default: 1
interval = 3.0

; Test connectivity every Nth update
; A value of 0 disables the feature
; NOTE: Experimental (needs more testing)
; Default: 0
;ping-interval = 3

; Accumulate values from all interfaces
; when querying for up/downspeed rate
; Default: false
accumulate-stats = true

; Consider an `UNKNOWN` interface state as up.
; Some devices like USB network adapters have 
; an unknown state, even when they're running
; Default: false
unknown-as-up = true

; Available tags:
;   <label-connected> (default)
;   <ramp-signal>
format-connected = %{F#ff217c}%{F-} <label-connected>

; Available tags:
;   <label-disconnected> (default)
format-disconnected = 

; Available tags:
;   <label-connected> (default)
;   <label-packetloss>
;   <animation-packetloss>
format-packetloss = <animation-packetloss> <label-connected>

; All labels support the following tokens:
;   %ifname%    [wireless+wired]
;   %local_ip%  [wireless+wired]
;   %local_ip6% [wireless+wired]
;   %essid%     [wireless]
;   %signal%    [wireless]
;   %upspeed%   [wireless+wired]
;   %downspeed% [wireless+wired]
;   %linkspeed% [wired]

; Default: %ifname% %local_ip%
label-connected = %local_ip%
label-connected-foreground = #eefafafa

; Default: (none)
label-disconnected = not connected
label-disconnected-foreground = #66ffffff

; Default: (none)
;label-packetloss = %essid%
;label-packetloss-foreground = #eefafafa

; Only applies if <ramp-signal> is used
ramp-signal-0 = 😱
ramp-signal-1 = 😠
ramp-signal-2 = 😒
ramp-signal-3 = 😊
ramp-signal-4 = 😃
ramp-signal-5 = 😈

; Only applies if <animation-packetloss> is used
animation-packetloss-0 =%{F#ff217c}%{F-} 
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 =%{F#ff217c}%{F-} 
animation-packetloss-1-foreground = #000000
; Framerate in milliseconds
animation-packetloss-framerate = 500



[module/network-wlan]
type = internal/network
; Name of the network interface to display. You can get the names of the
; interfaces on your machine with `ip link`
; Wireless interfaces often start with `wl` and ethernet interface with `eno` or `eth`
interface = wlp3s0

; Seconds to sleep between updates
; Default: 1
interval = 3.0

; Test connectivity every Nth update
; A value of 0 disables the feature
; NOTE: Experimental (needs more testing)
; Default: 0
;ping-interval = 3

; Accumulate values from all interfaces
; when querying for up/downspeed rate
; Default: false
accumulate-stats = true

; Consider an `UNKNOWN` interface state as up.
; Some devices like USB network adapters have 
; an unknown state, even when they're running
; Default: false
unknown-as-up = true

; Available tags:
;   <label-connected> (default)
;   <ramp-signal>
format-connected = %{F#ff217c}%{F-} <label-connected>

; Available tags:
;   <label-disconnected> (default)
format-disconnected = 

; Available tags:
;   <label-connected> (default)
;   <label-packetloss>
;   <animation-packetloss>
format-packetloss = <animation-packetloss> <label-connected>

; All labels support the following tokens:
;   %ifname%    [wireless+wired]
;   %local_ip%  [wireless+wired]
;   %local_ip6% [wireless+wired]
;   %essid%     [wireless]
;   %signal%    [wireless]
;   %upspeed%   [wireless+wired]
;   %downspeed% [wireless+wired]
;   %linkspeed% [wired]

; Default: %ifname% %local_ip%
label-connected =  %essid%
label-connected-foreground = #eefafafa

; Default: (none)
label-disconnected = not connected
label-disconnected-foreground = #66ffffff

; Default: (none)
;label-packetloss = %essid%
;label-packetloss-foreground = #eefafafa

; Only applies if <ramp-signal> is used
ramp-signal-0 = 😱
ramp-signal-1 = 😠
ramp-signal-2 = 😒
ramp-signal-3 = 😊
ramp-signal-4 = 😃
ramp-signal-5 = 😈

; Only applies if <animation-packetloss> is used
animation-packetloss-0 =%{F#ff217c}%{F-} 
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 =%{F#ff217c}%{F-} 
animation-packetloss-1-foreground = #000000
; Framerate in milliseconds
animation-packetloss-framerate = 500

[module/xkeyboard]
type = internal/xkeyboard

; List of indicators to ignore
blacklist-0 = num lock
blacklist-1 = scroll lock

; Available tags:
;   <label-layout> (default)
;   <label-indicator> (default)
format = <label-layout>
format-spacing = 0

; Available tokens:
;   %layout%
;   %name%
;   %number%
;   %icon%
; Default: %layout%
label-layout = %{F#ff217c}%{F-} %layout%
;label-layout-padding = 2
;label-layout-background = #bc99ed
;label-layout-foreground = #000

; Available tokens:
;   %name%
; Default: %name%
; @deprecated, use label-indicator-on
label-indicator = %name%

; layout-icon-[0-9]+ = layout;icon
; Assign each layout an icon that will be available as %icon% token for the
; <label-layout> tag. The part before ';' will try to match %layout% value.
layout-icon-default = some-icon
layout-icon-0 = ch;C
layout-icon-1 = us;U

; indicator-icon-[0-9]+ = indicator;off icon;on icon
; Provides the content of the %icon% token in label-indicator-*
indicator-icon-default = 
indicator-icon-0 = caps lock;-CL;+CL
indicator-icon-1 = scroll lock;;+SL
indicator-icon-2 = num lock;-NL;+NL

; Replaces label-indicator
; Available tokens:
;   %name%
;   %icon%
; Default: %name%
label-indicator-on = +%name%
; Available tokens:
;   %name%
;   %icon%
; Default: (none)
label-indicator-off = -%name%

; Replaces label-indicator-* if for specific indicators
; Available tokens:
;   %name%
;   %icon%
label-indicator-on-capslock = 
label-indicator-off-capslock = 
label-indicator-on-numlock = 
label-indicator-off-numlock = 
label-indicator-on-scrolllock = 
label-indicator-off-scrolllock = 

[module/battery-internal]
type = internal/battery

; This is useful in case the battery never reports 100% charge
full-at = 99

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT0
adapter = AC

; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
;
; Needed as a fallback for systems that don't report events
; on sysfs/procfs.
;
; Disable polling by setting the interval to 0.
;
; Default: 5
poll-interval = 5

; see "man date" for details on how to format the time string
; NOTE: if you want to use syntax tags here you need to use %%{...}
; Default: %H:%M:%S
time-format = %H:%M

; Available tags:
;   <label-charging> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   <animation-charging>
format-charging = <animation-charging> <label-charging>

; Available tags:
;   <label-discharging> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   <animation-discharging>
format-discharging = <ramp-capacity> <label-discharging>

; Available tags:
;   <label-full> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   format-full = <label-full>

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
;   %time%
;   %consumption% (shows current charge rate in watts)
label-charging = %percentage%%

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
;   %time%
;   %consumption% (shows current discharge rate in watts)
label-discharging = %percentage%%

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
 label-full = %{F#ff217c}%{F-} 100%

; Only applies if <ramp-capacity> is used
ramp-capacity-0 =%{F#ff217c}%{F-} 
ramp-capacity-1 =%{F#ff217c}%{F-} 
ramp-capacity-2 =%{F#ff217c}%{F-} 
ramp-capacity-3 =%{F#ff217c}%{F-} 
ramp-capacity-4 =%{F#ff217c}%{F-} 

; Only applies if <bar-capacity> is used
bar-capacity-width = 10

; Only applies if <animation-charging> is used
animation-charging-0 =%{F#ff217c}%{F-} 
animation-charging-1 =%{F#ff217c}%{F-} 
animation-charging-2 =%{F#ff217c}%{F-} 
animation-charging-3 =%{F#ff217c}%{F-} 
animation-charging-4 =%{F#ff217c}%{F-} 
; Framerate in milliseconds
animation-charging-framerate = 500

; Only applies if <animation-discharging> is used
animation-discharging-0 =%{F#ff217c}%{F-} 
animation-discharging-1 =%{F#ff217c}%{F-} 
animation-discharging-2 =%{F#ff217c}%{F-} 
animation-discharging-3 =%{F#ff217c}%{F-} 
animation-discharging-4 =%{F#ff217c}%{F-} 
; Framerate in milliseconds
animation-discharging-framerate = 500



[module/battery-external]
type = internal/battery

; This is useful in case the battery never reports 100% charge
full-at = 99

; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT1
adapter = AC

; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
;
; Needed as a fallback for systems that don't report events
; on sysfs/procfs.
;
; Disable polling by setting the interval to 0.
;
; Default: 5
poll-interval = 5

; see "man date" for details on how to format the time string
; NOTE: if you want to use syntax tags here you need to use %%{...}
; Default: %H:%M:%S
time-format = %H:%M

; Available tags:
;   <label-charging> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   <animation-charging>
format-charging = <animation-charging> <label-charging>

; Available tags:
;   <label-discharging> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   <animation-discharging>
format-discharging = <ramp-capacity> <label-discharging>

; Available tags:
;   <label-full> (default)
;   <bar-capacity>
;   <ramp-capacity>
;   format-full = <label-full>

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
;   %time%
;   %consumption% (shows current charge rate in watts)
label-charging = %percentage%%

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
;   %time%
;   %consumption% (shows current discharge rate in watts)
label-discharging = %percentage%%

; Available tokens:
;   %percentage% (default) - is set to 100 if full-at is reached
;   %percentage_raw%
 label-full = %{F#ff217c}%{F-} 100%

; Only applies if <ramp-capacity> is used
ramp-capacity-0 =%{F#ff217c}%{F-} 
ramp-capacity-1 =%{F#ff217c}%{F-} 
ramp-capacity-2 =%{F#ff217c}%{F-} 
ramp-capacity-3 =%{F#ff217c}%{F-} 
ramp-capacity-4 =%{F#ff217c}%{F-} 

; Only applies if <bar-capacity> is used
bar-capacity-width = 10

; Only applies if <animation-charging> is used
animation-charging-0 =%{F#ff217c}%{F-} 
animation-charging-1 =%{F#ff217c}%{F-} 
animation-charging-2 =%{F#ff217c}%{F-} 
animation-charging-3 =%{F#ff217c}%{F-} 
animation-charging-4 =%{F#ff217c}%{F-} 
; Framerate in milliseconds
animation-charging-framerate = 500

; Only applies if <animation-discharging> is used
animation-discharging-0 =%{F#ff217c}%{F-} 
animation-discharging-1 =%{F#ff217c}%{F-} 
animation-discharging-2 =%{F#ff217c}%{F-} 
animation-discharging-3 =%{F#ff217c}%{F-} 
animation-discharging-4 =%{F#ff217c}%{F-} 
; Framerate in milliseconds
animation-discharging-framerate = 500


[module/pulseaudio]
type = internal/pulseaudio

; Sink to be used, if it exists (find using `pacmd list-sinks`, name field)
; If not, uses default sink
sink = alsa_output.pci-0000_12_00.3.analog-stereo

; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false
; Default: true
use-ui-max = true

; Interval for volume increase/decrease (in percent points)
; Default: 5
interval = 5

; Available tags:
;   <label-volume> (default)
;   <ramp-volume>
;   <bar-volume>
format-volume = <ramp-volume> <label-volume>

; Available tags:
;   <label-muted> (default)
;   <ramp-volume>
;   <bar-volume>
;format-muted = <label-muted>

; Available tokens:
;   %percentage% (default)
;   %decibels% (unreleased)
;label-volume = %percentage%%

; Available tokens:
;   %percentage% (default)
;   %decibels% (unreleased)
label-muted = %{F#ff217c}%{F-} off
;label-muted-foreground = #666

; Only applies if <ramp-volume> is used
ramp-volume-0 =%{F#ff217c}%{F-} 
ramp-volume-1 =%{F#ff217c}%{F-} 
ramp-volume-2 =%{F#ff217c}%{F-} 

; Right and Middle click (unreleased)
click-right = pavucontrol &
; click-middle = 

[module/backlight]
type = internal/xbacklight

format = <label>

label = %{F#ff217c}%{F-} %percentage%%

; XRandR output to get get values from
; Default: the monitor defined for the running bar
; output = HDMI-1

; Create scroll handlers used to set the backlight value
; Default: true
enable-scroll = false

[module/date]
type = internal/date

; Seconds to sleep between updates
interval = 1.0

date = %d-%m-%Y%
time = %H:%M

label = %{F#ff217c}%{F-} %date% %time%

[module/separator]
type = custom/script
format = <label>
exec = echo "|"

[module/bluetooth]
type = custom/script
exec = echo "%{F#ff217c}%{F-}"
interval = 1
click-left = rofi-bluetooth

[module/power-menu]
type = custom/menu

; If true, <label-toggle> will be to the left of the menu items (default).
; If false, it will be on the right of all the items.
expand-right = true

; "menu-LEVEL-N" has the same properties as "label-NAME" with
; the additional "exec" property
;
; Available exec commands:
;   menu-open-LEVEL
;   menu-close
; Other commands will be executed using "/bin/sh -c $COMMAND"

menu-0-0 ="|"
menu-0-0-exec =
menu-0-1 ="%{F#ff217c}%{F-}"
menu-0-1-exec = systemctl suspend 
menu-0-2 = "%{F#ff217c}%{F-}"
menu-0-2-exec = reboot
menu-0-3 = "%{F#ff217c}%{F-}"
menu-0-3-exec = shutdown now
menu-0-4 = "%{F#ff217c}%{F-}"
menu-0-4-exec = loginctl lock-session 
menu-0-5 = "%{F#ff217c}%{F-}"
menu-0-5-exec = i3-msg exit




; Available tags:
;   <label-toggle> (default) - gets replaced with <label-(open|close)>
;   <menu> (default)
; If expand-right is true, the default will be "<label-toggle><menu>" and the
; other way around otherwise.
; Note that if you use <label-toggle> you must also include
; the definition for <label-open>
format =<menu>  <label-toggle>

label-open = "%{F#ff217c}%{F-}"

label-close = "%{F#ff217c}%{F-}"


; Optional item separator
; Default: none
label-separator = "  "

[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
;pseudo-transparency = false

[global/wm]
margin-top = 0
margin-bottom = 0

[module/redshift]
type = custom/script
format-prefix = " "
exec = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts/redshift.sh temperature
click-left = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts/redshift.sh toggle
scroll-up = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts/redshift.sh increase
scroll-down = source ~/.config/polybar/scripts/env.sh && ~/.config/polybar/scripts/redshift.sh decrease
interval=0.5

; vim:ft=dosini
